<?php include ('includes/header.php');?>
<?php include ('includes/db_connect.php');?>
<?php
	$sql = "SELECT * FROM complaints WHERE status = 1";
	if (isset($_GET['keyword'])) {
		$sql .= " WHERE complaint_title LIKE '%".$_GET['keyword']."%'";
	}
	$query = mysql_query($sql);
?>

<br>
<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header bg-primary text-center" style="text-shadow: 2px 2px 3px black; font-family:optimum; padding:6px">Resolved GERs</h3>
    </div>
</div>
<table class="table table-hover">
	<thead>
		<tr class="bg-info">
			<th></th>
			<th>Guest Name</th>
			<th>Villa</th>
			<!-- <th>NAT</th> -->
			<th>Issue</th>
			<th>DateComplaint</th>
			<th>F/U by</th>
			<th>Amount</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php while ($row = mysql_fetch_array($query)) { ?>
			<tr>
		<td><img src="<?php echo file_exists($row['thumb']) ? $row['thumb'] : 'images/guest.png';?>?<?php echo strtotime(date('Y-m-d H:i:s')); ?>" style="max-width: 60px;"/></td>
				<td <?php echo (strlen($row['guest_name']) > 17) ? 'title="'.$row['guest_name'].'"' : '' ?>><?php echo (strlen($row['guest_name']) > 17) ? substr($row['guest_name'], 0, 14).'...' : $row['guest_name'] ?></td>
				<td><?php echo $row['villa_no'] ?></td>
				<!-- // <td><?php echo $row['nationality'] ?></td> -->
				<td <?php echo (strlen($row['complaint_title']) > 17) ? 'title="'.$row['complaint_title'].'"' : '' ?>><?php echo (strlen($row['complaint_title']) > 17) ? substr($row['complaint_title'], 0, 14).'...' : $row['complaint_title'] ?></td>
				<td><?php echo date("M j, Y", strtotime($row['date_complaint'])) ?></td>
				<td <?php echo (strlen($row['follow_up']) > 17) ? 'title="'.$row['follow_up'].'"' : '' ?>><?php echo (strlen($row['follow_up']) > 17) ? substr($row['follow_up'], 0, 14).'...' : $row['follow_up'] ?></td>
				<td>IDR <?php echo number_format($row['price'], 0, '.', ',') ?></td>
				<td>
					<div class="btn-group">
						<!-- <button type="button" class="btn btn-primary">Act</button> -->
					 	<button type="button" class="btn btn-primary dropdown-toggle fa fa-edit" data-toggle="dropdown" aria-expanded="false">
					    <span class="caret"></span>
					    <span class="sr-only">Toggle Dropdown</span>
						</button>
						<ul class="dropdown-menu dropdown-menu-right" role="menu">
							<li><a href="complaint_view.php?id=<?php echo $row['id']; ?>">View</a></li>
							<!-- <li><a href="complaint_edit.php?id=<?php echo $row['id']; ?>">Edit</a></li> -->
							<!-- <li><a href="complaints_act.php?act=3&id=<?php echo $row['id']; ?>">Delete</a></li> -->
							<li><a href="complaints_act.php?act=5&id=<?php echo $row['id']; ?>">re-Open</a></li>
						</ul>
					</div>
				</td>
			</tr>
		<?php } ?>
	</tbody>
</table>
<?php include ('includes/footer.php');?>